package binarycrew.livewallpapers.wallpapers;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

/**
 * User: Richard MihaloviÄ�
 */
public class LiveWallpaper_2 extends ALiveWallpaper{
    private Integer angle = 0;

    public LiveWallpaper_2(){
        this.code = "wallpaper_2";
    }

    @Override
    public String getName() {
        return "Sample wallpaper #2";
    }

    @Override
    public String getDescription() {
        return "Example wallpaper #1";
    }

    @Override
    public Double getFPS() {
        return (double) 25;
    }

    @Override
    public void create() {
    }

    @Override
    public void destroy() {
    }

    @Override
    public void drawCanvas(Canvas canvas) {
        if(!isInitialised) return;

        // clear background
        canvas.drawColor(Color.BLACK);

        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        paint.setStyle(Paint.Style.STROKE);
        paint.setColor(Color.RED);
        paint.setStrokeWidth(3);
        paint.setTextSize(30);
        paint.setTextAlign(Paint.Align.CENTER);

        int centerX = getWidth() / 2;
        int centerY = getHeight() / 2;

        int radius = 20;
        int offset = 50;

        int px = (int) (centerX + offset * Math.sin(Math.toRadians(angle)));
        int py = (int) (centerY - offset * Math.cos(Math.toRadians(angle)));

        canvas.drawCircle(
            px,
            py,
            radius,
            paint
        );

        angle += 5;
        if(angle > 360) angle -= 360;
    }
}